<?php

namespace App\Http\Controllers;

use App\Notifications\InvoicePaid;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification;

class NotifyController extends Controller
{
    //测试通知发送功能
    public function index()
    {
        //模拟订单下单概要信息
        $order = [
            'id' => 1,
            'amount' => 22,
        ];
        $user = User::find(1);
        $user->notify(new InvoicePaid($order));

        //$ids = UserSubscribe::where('type', 'goods_discount')->where('refer_id', $goodsId)->pluck('user_id');
        //$users = User::whereIn('id', $ids)->get();
        //Notification::send($users, new SubscribeRemind(['goods_id' => $goodsId, 'type' => 'goods_discount']));
        return response()->json(['ok']);
    }
}
